home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Utilities / Apple File Exchange / AppleFile Exchange Translator / ExampleTrans / Example.r < prev    next >
Text File  |  1989-04-13  |  3KB  |  81 lines

  1. /* Example Translation inclusion  Resource Definition File         */
  2. /*                                                                 */
  3. /*   written by Karl B. Young 7/16/87                              */
  4.  
  5.  
  6. /* include any static resources like dialogs, strings, etc. */
  7. include "Example.rsrc";
  8.  
  9. /* include the code itself */
  10. include ":Objects:Example.tmp" 'MCMC' (4000) as 'MCMC' (4000,"STR# Resources to Text…",PURGEABLE);
  11.  
  12. /* include the About text */
  13. read 'TEXT' (4000) "Example.txt";
  14.  
  15. /* Create a STR# resource containing all the error strings our translator */
  16. /* produces. The str_xxxxx are the constants used to reference each string */
  17. /* in Example.p */
  18. resource 'STR#' (4000) { {
  19.  
  20.     /*     str_error        = 1; */ "An error occurred while ";
  21.     /*     str_creating    = 2; */ "creating the destination file: ";
  22.     /*     str_opensrc        = 3; */ "opening the source file: ";
  23.     /*     str_opendst        = 4; */ "opening the destination file: ";
  24.     /*     str_getfinfo    = 5; */ "getting information about the file: ";
  25.     /*     str_setfinfo    = 6; */ "setting the file type of the destination file: ";
  26.     /*    str_reading        = 7; */ "reading in the source file: ";
  27.     /*  str_writing        = 8; */ "writing out the destination file: ";
  28.     /*  str_copying        = 9; */ "Copying STR# resources…";
  29.     /*    str_initing        = 10; */ "initializing the translator '";
  30.     /*    str_period        = 11; */ "'.";
  31.     /*    str_cant        = 12; */ "It cannot translate from '";
  32.     /*    str_to            = 13; */ "' to '";
  33.     /*    str_delsrc        = 14; */ "deleting the original file (your translated data is in the file $$$AFE-TEMP$$$): ";
  34.     /*    str_rendst        = 15; */ "renaming the destination file (your translated data is in the file $$$AFE-TEMP$$$): ";
  35.     /*    str_numstrings    = 16; */ "Number of STR# resources in this file: ";
  36.     /*    str_stringRes    = 17; */ "String Resource Number "
  37.     } };
  38.     
  39. /* The following is used to create a different icon for the translator */
  40. /* The new icon was created by using ResEdit to modify the standard    */
  41. /* translator icon. For more detail see Inside Mac III, pp.10-13 */
  42. /* define the resource type? as a string type */
  43.  
  44. /* The file "Signature.r" is created by the make file ("Example.make") and contains */
  45. /* the signature resource (in this case, of type 'exmp') necessary for displaying */
  46. /* a different icon */
  47. /* The text in the "exmp" resource will be diplayed when a Get Info is done on the */
  48. /* translator in the Finder*/
  49. #include ":objects:Signature.r"
  50.  
  51. /* The BNDL id number (0) is necessary but not important, it is never used */
  52. resource 'BNDL' (0) {
  53.     'exmp',    
  54.     0,
  55.     {
  56.     /* Map the local icon number 0 to the actual icon resource 128 */
  57.     /* we use ICN# instead of ICON so that the mask is included, the */
  58.     /* mask is how the icon looks highlighted */    
  59.         'ICN#',
  60.         {
  61.             0, 128
  62.         },
  63.     /* Map local FREF 0 to FREF 128 */
  64.         'FREF',
  65.         {
  66.             0, 128
  67.         }
  68.     }
  69. };
  70.  
  71.  
  72. /* Create a file reference resource of id=128 that associates type VISA */
  73. /* with the icon of local ID = 0 ; */
  74. resource 'FREF' (128) {
  75.     'VISA',
  76.     0,
  77.     ""
  78. };
  79. /* for this icon to be used with the translator the bundle bit */
  80. /* must be set. This is done with the setfile -a B 'Example Tran' */
  81. /* statement in MPW after building the translator with rez */